
/*
 * Copyright 2002-2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2022原作者。
 *
 *根据Apache许可证2.0版（“许可证”）获得许可；
 *除非符合许可证，否则不得使用此文件。
 *您可以在以下地址获取许可证副本：
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，软件
 *根据许可证分发的内容是按“原样”分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限和
 *许可证下的限制。
 */

package org.springframework.beans.factory.aot;

import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.lang.Nullable;

/**
 * AOT processor that makes bean factory initialization contributions by
 * processing {@link ConfigurableListableBeanFactory} instances.
 *
 * <p>{@code BeanFactoryInitializationAotProcessor} implementations may be
 * registered in a {@value AotServices#FACTORIES_RESOURCE_LOCATION} resource or
 * as a bean.
 *
 * <p>Using this interface on a registered bean will cause the bean <em>and</em>
 * all of its dependencies to be initialized during AOT processing. We generally
 * recommend that this interface is only used with infrastructure beans such as
 * {@link BeanFactoryPostProcessor} which have limited dependencies and are
 * already initialized early in the bean factory lifecycle. If such a bean is
 * registered using a factory method, make sure to make it {@code static} so
 * that its enclosing class does not have to be initialized.
 *
 * <p>A component that implements this interface is not contributed.
 *
 * @author Phillip Webb
 * @author Stephane Nicoll
 * @since 6.0
 * @see BeanFactoryInitializationAotContribution
 */
/**
 *AOT处理器，通过
 *正在处理｛@link ConfigurationListableBeanFactory｝实例。
 *
 *＜p＞｛@code BeanFactoryInitializationAotProcessor｝实现可能是
 *在｛@value AotServices#FACTORIES_RESOURCE_LOCATION｝资源中注册，或
 *像豆子一样。
 *
 *＜p＞在注册的bean上使用此接口将导致bean＜em＞和</em>
 *在AOT处理期间初始化其所有依赖项。我们通常
 *建议此接口仅用于基础结构bean，例如
 *｛@link BeanFactoryPostProcessor｝具有有限的依赖关系
 *已经在bean工厂生命周期的早期初始化。如果这种豆子是
 *使用工厂方法注册，请确保使其｛@code static｝
 *它的封闭类不必初始化。
 *
 *＜p＞实现此接口的组件没有贡献。
 *
 *@作者Phillip Webb
 *@作者Stephane Nicoll
 *@自6.0起
 *@参见BeanFactoryInitializationAotContribution
 */
@FunctionalInterface
public interface BeanFactoryInitializationAotProcessor {

	/**
	 * Process the given {@link ConfigurableListableBeanFactory} instance
	 * ahead-of-time and return a contribution or {@code null}.
	 * <p>Processors are free to use any techniques they like to analyze the given
	 * bean factory. Most typically use reflection to find fields or methods to
	 * use in the contribution. Contributions typically generate source code or
	 * resource files that can be used when the AOT optimized application runs.
	 * <p>If the given bean factory does not contain anything that is relevant to
	 * the processor, this method should return a {@code null} contribution.
	 * @param beanFactory the bean factory to process
	 * @return a {@link BeanFactoryInitializationAotContribution} or {@code null}
	 */
	/**
	 *处理给定的｛@link ConfigurationListableBeanFactory｝实例
	 *并返回一个贡献或{@codenull}。
	 *<p>处理器可以自由使用他们喜欢的任何技术来分析给定的
	 *豆工厂。大多数通常使用反射来查找字段或方法
	 *在贡献中使用。贡献通常生成源代码或
	 *AOT优化应用程序运行时可以使用的资源文件。
	 *＜p＞如果给定的bean工厂不包含与
	 *对于处理器，此方法应返回{@codenull}贡献。
	 *@param beanFactory要处理的bean工厂
	 *@return一个｛@link BeanFactoryInitializationAotContribution｝或｛@code null｝
	 */
	@Nullable
	BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory);

}
